﻿(function () {
    var oneworks = function () {
    };
    oneworks.prototype = {
        page: {},
        config: {
            APPUSER: 'APPUSER',
            LOGINERRORCOUNT: 'LOGINERRORCOUNT'
        },
        regex: {
            chinese: "^[\\u4e00-\\u9fa5]+$", //仅中文
            color: "^[a-fA-F0-9]{6}$", //颜色
            date: "^\\d{4}(\\-|\\/|\.)\\d{1,2}\\1\\d{1,2}$", //日期
            email: "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$", //邮件
            idcard: "^[1-9]([0-9]{14}|[0-9]{17})$", //身份证
            ip4: "^(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)$", //ip地址
            letter: "^[A-Za-z]+$", //字母
            letter_l: "^[a-z]+$", //小写字母
            letter_u: "^[A-Z]+$", //大写字母
            mobile: "^0?(13|15|17|18|14)[0-9]{9}$", //手机
            notempty: "^\\S+$", //非空
            password: "^.*[A-Za-z0-9\\w_-]+.*$", //密码
            fullNumber: "^[0-9]+$", //数字
            picture: "(.*)\\.(jpg|bmp|gif|ico|pcx|jpeg|tif|png|raw|tga)$", //图片
            qq: "^[1-9]*[1-9][0-9]*$", //QQ号码
            tel: "^[0-9\-()（）]{7,18}$", //电话号码的函数(包括验证国内区号,国际区号,分机号)
            url: "^http[s]?:\\/\\/([\\w-]+\\.)+[\\w-]+([\\w-./?%&=]*)?$", //url
            zipcode: "^\\d{6}$" //邮编
        },
        CreatePage: function (name, prop, fun) {
            var that = this;
            if (typeof that.page[name] === 'undefined') {
                var f = fun;
                $.extend(true, f.prototype, prop);
                that.page[name] = new fun();
                return that.page[name];
            } else {
                throw name + ' already exists ';
            }
        }
    };
    oneworks.prototype.fn = oneworks.prototype;
    window.Oneworks = new oneworks();
} ());